#pragma once

#include "JuliaNervusChain.h"
#include "NervusChainArray.h"
#include "TrainingCaseDB.h"

class JuliaBrain
{
public:
	JuliaBrain(void);
	~JuliaBrain(void);

	void BuildNervusChain( int nIdx, Complex );
	void ReleaseNervusChain( int nIdx );

	bool RunTrainingCase( int nIdx );

	float RunAllTrainingCase( Complex );

	void SetChainDef( int nSigNum, int nNervusNum, int nToNervusNum );
	void SetOneChainDef( int nChainIdx, int nNervusNum, int* pToNervusNum );
	bool LoadChainDefFromFile( int running_id );
	void SaveChainDefToFile( int running_id );
	void PrintChainDef( void );

	Complex TryTrainingCase( Complex def, int nIdx );
	void TryAllCase( Complex def, double& dMinAngle, double& dMaxAngle );
private:
	//JuliaNervusChain *m_jChain[MAX_CASE];
	NervusChainArray* m_nArray[MAX_CASE];
	CTrainingCaseDB *m_pTrainingCaseDB;
	JuliaChainDefine m_chDefine[NERVUS_SIGNAL_COUNT*NERVUS_CHAIN_COUNT];
	int m_nCurrentChangedChain;
};

